<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">
<section class="content-header"><h1>物控状态变更查询</h1></section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" onsubmit="return false;">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group">
                                    <label>项目编号</label>
                                    <input type="text" name="pscProCode" class="form-control" placeholder="请输入项目编号">
                                </div>
                                <div class="form-group">
                                    <label>项目名称</label>
                                    <input type="text" name="pscProName" class="form-control" placeholder="请输入项目名称">
                                </div>
                                <div class="form-group">
                                    <label>变更人</label>
                                    <input type="text" name="pscChangeOperator" class="form-control" placeholder="请输入项目名称">
                                </div>
                                <div class="form-group">
                                    <label>分类</label>
                                    <select name="pscStatusType" class="form-control">
                                        <option value="" selected="selected">全部</option>
                                        <option value="原材料">原材料</option>
                                        <option value="外购件">外购件</option>
                                        <option value="外协件">外协件</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label class="">变更时间</label>
                                        <input name="startDate" class="form-control datepicker"  readonly/>
                                        至
                                        <input name="endDate" class="form-control datepicker"  readonly/>
                                </div>
                                <button type="button" class="btn btn-success" id="btn-search">
                                    <span class="Bold">搜索</span>
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">

    /** 表格 */
    var table;
    /** 状态 **/
    var reportStatusOfMaterialControlDepartment = ['无状态', '正常提报', '暂不提报', '部分提报'];
    /** 状态颜色 **/
    var reportStatusOfMaterialControlDepartmentColor = ['label-default', 'label-info', 'label-primary', 'label-warning'];



    $(function () {

        /** 初始化表格 */
        table = js.table.init({
            url: ctx + "overview/matstatus/list",
            columns: [
                {
                    title: '序号', field: 'proId', width: '40',
                    formatter: function (value, row, index, field) {
                        return index + 1;
                    }
                },
                {title: "项目编号", field: 'pscProCode',width: '90',},
                {title: "项目名称", field: 'pscProName',width: '280'},
                {title: "分类", field: 'pscStatusType',width: '60',},
                {
                    title: "变更前状态", field: 'pscBeforeStatus',width: '80',
                    formatter: function (value, row, index) {
                        if(value===null){
                            value = 0;
                        }
                        return '<span class="badge ' + reportStatusOfMaterialControlDepartmentColor[value] + '">' + reportStatusOfMaterialControlDepartment[value] + '</span> ';
                    }
                },
                {
                    title: "变更后状态", field: 'pscAfterStatus',width: '80',
                    formatter: function (value, row, index) {
                        if(value===null){
                            value = 0;
                        }
                        return '<span class="badge ' + reportStatusOfMaterialControlDepartmentColor[value] + '">' + reportStatusOfMaterialControlDepartment[value] + '</span> ';
                    }
                },
                {
                    title: "变更人", field: 'pscChangeOperator',width: '80'
                },
                {
                    title: "变更时间", field: 'pscChangeDateStr',width: '90'
                }
            ]
        });

        /**
         * 表格搜索
         */
        $("#btn-search").click(function () {
            js.table.search(table);
        });

    });

</script>
</body>
</html>
